import pymysql

conn = pymysql.connect(
host='127.0.0.1',
port=3306,
user='root',
password='123456',
db='py91',
charset='utf8'
)
cursor = conn.cursor()
sql = "insert into student values(12,'kobe','f','123457',2)"
rows = cursor.execute(sql)

conn.commit()
cursor.close()
conn.close()